#	$OpenBSD: genassym.cf,v 1.37 2015/04/12 18:37:53 mlarkin Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. Neither the name of the University nor the names of its contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#	@(#)genassym.c	7.8 (Berkeley) 5/7/91
#

include <sys/param.h>
include <sys/proc.h>
include <sys/resourcevar.h>
include <sys/device.h>
include <sys/user.h>
include <sys/mbuf.h>
include <sys/socketvar.h>
include <netinet/in.h>
include <netinet/ip.h>
include <netinet/ip_var.h>

include <uvm/uvm_extern.h>

include <machine/trap.h>
include <machine/pmap.h>
include <machine/vmparam.h>
include <machine/mutex.h>

if COMPAT_LINUX > 0
include <machine/linux_machdep.h>
endif

if MULTIPROCESSOR
include <machine/cpu.h>
endif

include "isa.h"
if NISA > 0
include <i386/isa/isa_machdep.h>
endif

export	SRUN
export	SONPROC

# values for page tables
export	PDSLOT_KERN
export	PDSLOT_PTE
export	PDSLOT_APTE
export	NKPTP_MIN

# values for virtual memory
export	VM_MAXUSER_ADDRESS

# proc fields and values
struct	proc
member	p_addr
member	p_priority
member	p_stat
member	p_wchan
member	p_vmspace
member	p_flag
member	p_cpu
member	P_MD_ASTPENDING	p_md.md_astpending

export	P_SYSTEM

# interrupt/fault metering
struct	uvmexp		V_
member	TRAP		traps
member	INTR		intrs

# pcb fields
struct	pcb
member	pcb_cr3
member	pcb_ebp
member	pcb_esp
member	pcb_cr0
member	pcb_ldt
member	pcb_ldt_sel
member	pcb_onfault
member	pcb_fpcpu
member	pcb_flags
member	pcb_pmap
export	PCB_SAVECTX

# frame definitions
struct	trapframe
member	tf_cs
member	tf_trapno
member	tf_eflags
member	tf_eip
member	tf_err
member	tf_eax
member	tf_esp
define	FRAMESIZE	sizeof(struct trapframe)

# interrupt frame definitions
struct intrframe
member if_ppl

# signal handling
struct	sigframe	SIGF_
member	HANDLER		sf_handler
member	SC		sf_sc
struct	sigcontext

# mbuf fields
struct	mbuf
member	m_next
member	m_data
member	m_len

# Linux frame offsets
ifdef COMPAT_LINUX
struct	linux_sigframe		LINUX_SIGF_
member	HANDLER			sf_handler
member	SC			sf_sc
struct	linux_sigcontext	LINUX_
endif

# Interrupt metering
if NISA > 0
struct	intrhand
member	ih_fun
member	ih_arg
member	IH_COUNT		ih_count.ec_count
member	ih_next
endif

struct mutex
member	mtx_lock
member	mtx_wantipl
member	mtx_oldipl
member	mtx_owner

define	IP_SRC			offsetof(struct ip, ip_src)
define	IP_DST			offsetof(struct ip, ip_dst)

define	P_MD_TSS_SEL		offsetof(struct proc, p_md.md_tss_sel)

define	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
define	CPU_INFO_APICID		offsetof(struct cpu_info, ci_apicid)
define	CPU_INFO_CURPROC	offsetof(struct cpu_info, ci_curproc)
define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
define	CPU_INFO_NAME		offsetof(struct cpu_info, ci_dev.dv_xname)
define	CPU_INFO_IDLE_PCB	offsetof(struct cpu_info, ci_idle_pcb)
define	CPU_INFO_IDLE_TSS_SEL	offsetof(struct cpu_info, ci_idle_tss_sel)
define	CPU_INFO_LEVEL		offsetof(struct cpu_info, ci_level)
define	CPU_INFO_VENDOR		offsetof(struct cpu_info, ci_vendor[0])
define	CPU_INFO_SIGNATURE	offsetof(struct cpu_info, ci_signature)
define	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
define	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_ipending)
define	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
define	CPU_INFO_IUNMASK	offsetof(struct cpu_info, ci_iunmask)
define	CPU_INFO_ILEVEL		offsetof(struct cpu_info, ci_ilevel)
define	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
define	CPU_INFO_ISOURCES	offsetof(struct cpu_info, ci_isources)
ifdef DIAGNOSTIC
define	CPU_INFO_MUTEX_LEVEL	offsetof(struct cpu_info, ci_mutex_level)
endif
define	CPU_INFO_CURPMAP	offsetof(struct cpu_info, ci_curpmap)

struct pmap
member pm_pdirpa

define	SIZEOF_CPU_INFO		sizeof(struct cpu_info)

